import {Component, Input, OnChanges, OnInit} from "@angular/core";
import {UtilService} from "src/app/core/util/util.service";
import {StatBase} from "../statistics/stat-base";
import * as echarts from "echarts";

@Component({
  selector: "app-irr-info-panel",
  templateUrl: "./irr-info-panel.component.html",
  styleUrls: ["./irr-info-panel.component.scss"]
})
export class IrrInfoPanelComponent extends StatBase implements OnInit {
  @Input() type: number = 1;
  stationOptChange1;
  stationOptChange2;
  tableData = [
    {name: '一所', planArea: '83575', totalArea: '66800', per: '79.9%'},
    {name: '二所', planArea: '90829', totalArea: '76296', per: '83.9%'},
  ];

  constructor(private util: UtilService) {
    super();
  }

  ngOnInit(): void {
    this.renderChartStation();
  }

  renderChartStation(): void {
    this.stationOptChange1 = {
      title: {
        text: "一所作物"
      },
      xAxis: {
        data: ["水稻", "小麦", "经果林", "玉米"]
      },
      yAxis: {
        name: "面积(万亩)"
      },
      series: [
        {
          data: [0.77, 0.74, 2.1, 8.38],
          itemStyle: {
            normal: {
              label: {
                show: true,
                position: 'top',
              }
            }
          }
        }
      ]
    };
    this.stationOptChange2 = {
      title: {
        text: "二所作物"
      },
      xAxis: {
        data: ["水稻", "小麦", "经果林", "玉米"]
      },
      yAxis: {
        name: "面积(万亩)"
      },
      series: [
        {
          data: [0.00, 0.66, 2.02, 6.41],
          itemStyle: {
            normal: {
              label: {
                show: true,
                position: 'top',
              }
            }
          }
        }
      ]
    };
  }
}
